package com.dazzle.system.dao.impl;

import java.util.List;

import com.dazzle.core.dao.impl.GenericDaoImpl;
import com.dazzle.system.dao.SysTypeDao;
import com.dazzle.system.entity.SysType;

@SuppressWarnings("unchecked")
public class SysTypeDaoImpl extends GenericDaoImpl<SysType, Long> implements SysTypeDao{
	public SysTypeDaoImpl(){
		super(SysType.class);
	}

	@Override
	public List<SysType> getAllRootOfSys() {
		String hql ="from SysType st where st.isRoot = ? and st.belongTo is null";
		List<SysType> list = findByHql(hql, new Object[]{1});	
		return list;
	}

	@Override
	public List<SysType> getAllByParentId(Long rootId) {
		String hql ="from SysType st where st.parentId = ?";
		List<SysType> list = findByHql(hql, new Object[]{rootId});	
		return list;
	}
	
}